package com.twl.app.base.ctrl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.twl.app.base.bo.ParamBoImpl;
import com.twl.app.base.entity.Checktemplet;
import com.twl.app.base.entity.OpenState;
import com.twl.core.framework.ctrl.AbsCrudCtrl; 
/***
 * 记录信息
 * @author uatzhangxc
 *
 */
@Service("paramCtrlImpl")
public class ParamCtrlImpl extends AbsCrudCtrl<ParamBoImpl>{
	 /**
	  * 查询信息
	  * @return
	  */
	public List<OpenState> findparamset(String id){
		String sql="from OpenState as s where s.openDate='"+id+"' order by id desc";
		  List<OpenState> open= bo.findparam(sql);
		  return open;
	}
	
	public void getfind(Checktemplet let){
		String sql="from OpenState as s where s.openDate='"+let.getPeriod()+"'";
		  List<OpenState> open= bo.findparam(sql);
		  
	       if(open.size()>0){
	    	     String hql="update OpenState set counting=counting+1 where id="+open.get(0).getId()+"";
	    	     //修改记录
	   		    bo.updateparam(sql);
	       }else{
	    	   OpenState stat=new OpenState();
	    	   stat.setCounting(1);
	    	   stat.setOpenCheck("0");
	    	   stat.setOpenDate(let.getPeriod());
	    	
	    	   bo.saveparam(stat); 
	       }
	}
}
